home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 August: Tool Chest / Dev.CD Aug 95 TC / Dev.CD Aug 95 TC.toast / Tool Chest / Interfaces / UniversalInterfaces 2.1B1 / AIncludes / Aliases.a < prev    next >
Encoding:
Text File  |  1995-04-18  |  5.5 KB  |  199 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        Aliases.a
  3. ;
  4. ;    Contains:    Alias Manager Interfaces.
  5. ;
  6. ;    Version:    Technology:    System 7.5
  7. ;                Package:    Universal Interfaces 2.1ß1 in “MPW Prerelease” on ETO #17
  8. ;
  9. ;    Copyright:    © 1984-1995 by Apple Computer, Inc.
  10. ;                All rights reserved.
  11. ;
  12. ;    Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13. ;                stack.  Include the file and version information (from above)
  14. ;                in the problem description and send to:
  15. ;                    Internet:    apple.bugs@applelink.apple.com
  16. ;                    AppleLink:    APPLE.BUGS
  17. ;
  18. ;
  19.  
  20.     IF &TYPE('__ALIASES__') = 'UNDEFINED' THEN
  21. __ALIASES__ SET 1
  22.  
  23.  
  24.     IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
  25.     include 'Types.a'
  26.     ENDIF
  27. ;        include 'ConditionalMacros.a'                                ;
  28.  
  29.     IF &TYPE('__APPLETALK__') = 'UNDEFINED' THEN
  30.     include 'AppleTalk.a'
  31.     ENDIF
  32. ;        include 'OSUtils.a'                                        ;
  33. ;            include 'MixedMode.a'                                    ;
  34. ;            include 'Memory.a'                                        ;
  35.  
  36.     IF &TYPE('__FILES__') = 'UNDEFINED' THEN
  37.     include 'Files.a'
  38.     ENDIF
  39.  
  40. rAliasType                        EQU        'alis'                ; Aliases are stored as resources of this type 
  41. ; define alias resolution action rules mask 
  42. kARMMountVol                    EQU        $00000001            ; mount the volume automatically 
  43. kARMNoUI                        EQU        $00000002            ; no user interface allowed during resolution 
  44. kARMMultVols                    EQU        $00000008            ; search on multiple volumes 
  45. kARMSearch                        EQU        $00000100            ; search quickly 
  46. kARMSearchMore                    EQU        $00000200            ; search further 
  47. kARMSearchRelFirst                EQU        $00000400            ; search target on a relative path first 
  48. ; define alias record information types 
  49. asiZoneName                        EQU        -3                    ; get zone name 
  50. asiServerName                    EQU        -2                    ; get server name 
  51. asiVolumeName                    EQU        -1                    ; get volume name 
  52. asiAliasName                    EQU        0                    ; get aliased file/folder/volume name 
  53. asiParentName                    EQU        1                    ; get parent folder name 
  54.  
  55. ; define the alias record that will be the blackbox for the caller 
  56. AliasRecord             RECORD    0
  57. userType                 ds.l   1        ; offset: $0 (0)        ; appl stored type like creator type 
  58. aliasSize                 ds.w   1        ; offset: $4 (4)        ; alias record size in bytes, for appl usage 
  59. sizeof                     EQU *            ; size:   $6 (6)
  60.                         ENDR
  61.  
  62. ; typedef struct AliasRecord  AliasRecord
  63. ; typedef AliasRecord         *AliasPtr, **AliasHandle
  64. ; alias record information type 
  65. ; typedef short             AliasInfoType
  66. ;
  67. ; pascal OSErr NewAlias(ConstFSSpecPtr fromFile, const FSSpec *target, AliasHandle *alias)
  68. ;
  69.     IF ¬ GENERATINGCFM THEN
  70.         Macro
  71.         _NewAlias
  72.             moveq    #2,d0
  73.             dc.w     $A823
  74.         EndM
  75.     ELSE
  76.         IMPORT_CFM_FUNCTION    NewAlias
  77.     ENDIF
  78.  
  79. ; create a minimal new alias for a target and return alias record handle 
  80. ;
  81. ; pascal OSErr NewAliasMinimal(const FSSpec *target, AliasHandle *alias)
  82. ;
  83.     IF ¬ GENERATINGCFM THEN
  84.         Macro
  85.         _NewAliasMinimal
  86.             moveq    #8,d0
  87.             dc.w     $A823
  88.         EndM
  89.     ELSE
  90.         IMPORT_CFM_FUNCTION    NewAliasMinimal
  91.     ENDIF
  92.  
  93. ; create a minimal new alias from a target fullpath (optional zone and server name) and return alias record handle  
  94. ;
  95. ; pascal OSErr NewAliasMinimalFromFullPath(short fullPathLength, const void *fullPath, ConstStr32Param zoneName, ConstStr31Param serverName, AliasHandle *alias)
  96. ;
  97.     IF ¬ GENERATINGCFM THEN
  98.         Macro
  99.         _NewAliasMinimalFromFullPath
  100.             moveq    #9,d0
  101.             dc.w     $A823
  102.         EndM
  103.     ELSE
  104.         IMPORT_CFM_FUNCTION    NewAliasMinimalFromFullPath
  105.     ENDIF
  106.  
  107. ; given an alias handle and fromFile, resolve the alias, update the alias record and return aliased filename and wasChanged flag. 
  108. ;
  109. ; pascal OSErr ResolveAlias(ConstFSSpecPtr fromFile, AliasHandle alias, FSSpec *target, Boolean *wasChanged)
  110. ;
  111.     IF ¬ GENERATINGCFM THEN
  112.         Macro
  113.         _ResolveAlias
  114.             moveq    #3,d0
  115.             dc.w     $A823
  116.         EndM
  117.     ELSE
  118.         IMPORT_CFM_FUNCTION    ResolveAlias
  119.     ENDIF
  120.  
  121. ; given an alias handle and an index specifying requested alias information type, return the information from alias record as a string. 
  122. ;
  123. ; pascal OSErr GetAliasInfo(AliasHandle alias, AliasInfoType index, Str63 theString)
  124. ;
  125.     IF ¬ GENERATINGCFM THEN
  126.         Macro
  127.         _GetAliasInfo
  128.             moveq    #7,d0
  129.             dc.w     $A823
  130.         EndM
  131.     ELSE
  132.         IMPORT_CFM_FUNCTION    GetAliasInfo
  133.     ENDIF
  134.  
  135. ;  Given a file spec, return target file spec if input file spec is an alias.
  136. ;  It resolves the entire alias chain or one step of the chain.  It returns
  137. ;  info about whether the target is a folder or file; and whether the input
  138. ;  file spec was an alias or not. 
  139. ;
  140. ;
  141. ; pascal OSErr ResolveAliasFile(FSSpec *theSpec, Boolean resolveAliasChains, Boolean *targetIsFolder, Boolean *wasAliased)
  142. ;
  143.     IF ¬ GENERATINGCFM THEN
  144.         Macro
  145.         _ResolveAliasFile
  146.             moveq    #12,d0
  147.             dc.w     $A823
  148.         EndM
  149.     ELSE
  150.         IMPORT_CFM_FUNCTION    ResolveAliasFile
  151.     ENDIF
  152.  
  153. ;
  154. ; pascal OSErr FollowFinderAlias(ConstFSSpecPtr fromFile, AliasHandle alias, Boolean logon, FSSpec *target, Boolean *wasChanged)
  155. ;
  156.     IF ¬ GENERATINGCFM THEN
  157.         Macro
  158.         _FollowFinderAlias
  159.             moveq    #15,d0
  160.             dc.w     $A823
  161.         EndM
  162.     ELSE
  163.         IMPORT_CFM_FUNCTION    FollowFinderAlias
  164.     ENDIF
  165.  
  166. ;   Low Level Routines 
  167. ; Given an alias handle and fromFile, match the alias and return aliased filename(s) and needsUpdate flag
  168. ;
  169. ;
  170. ; pascal OSErr MatchAlias(ConstFSSpecPtr fromFile, unsigned long rulesMask, AliasHandle alias, short *aliasCount, FSSpecArrayPtr aliasList, Boolean *needsUpdate, AliasFilterUPP aliasFilter, void *yourDataPtr)
  171. ;
  172.     IF ¬ GENERATINGCFM THEN
  173.         Macro
  174.         _MatchAlias
  175.             moveq    #5,d0
  176.             dc.w     $A823
  177.         EndM
  178.     ELSE
  179.         IMPORT_CFM_FUNCTION    MatchAlias
  180.     ENDIF
  181.  
  182. ; given a fromFile-target pair and an alias handle, update the lias record pointed to by alias handle to represent target as the new alias. 
  183. ;
  184. ; pascal OSErr UpdateAlias(ConstFSSpecPtr fromFile, const FSSpec *target, AliasHandle alias, Boolean *wasChanged)
  185. ;
  186.     IF ¬ GENERATINGCFM THEN
  187.         Macro
  188.         _UpdateAlias
  189.             moveq    #6,d0
  190.             dc.w     $A823
  191.         EndM
  192.     ELSE
  193.         IMPORT_CFM_FUNCTION    UpdateAlias
  194.     ENDIF
  195.  
  196.     ENDIF ; __ALIASES__
  197.